home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 203 (1992-06-10)(Manewaldt, A.)(DE)(PD).zip / Taifun 203 (1992-06-10)(Manewaldt, A.)(DE)(PD).adf / Fenster / Objectfiles / ImageDemo.c < prev    next >
C/C++ Source or Header  |  1992-06-06  |  2KB  |  88 lines

  1. /* -------------------------------------------------------------- */
  2. /* --                     ImageDemo.c                          -- */
  3. /* -------------------------------------------------------------- */
  4. /* -- Author    : Roger Fischlin                               -- */
  5. /* -- Copyright : Public Domain                                -- */
  6. /* -- Compiler  : SAS-C V5.10a, "LC -L+Fish.o ImageDemo"       -- */
  7. /* -------------------------------------------------------------- */
  8.  
  9. /* image size (taken from SAVE Requester) */
  10. #define WIDTH 132
  11. #define HEIGHT 57
  12.  
  13.  
  14. /* includes */
  15. #include <intuition/intuition.h>
  16. #include <proto/intuition.h>
  17. #include <proto/exec.h>
  18.  
  19.  
  20. /* -------------------- vars -------------------------- */
  21.  
  22. struct Library *IntuitionBase;
  23.  
  24. struct Window *WD;
  25.  
  26. struct NewWindow NW =
  27. {
  28.    20,20,WIDTH+40,HEIGHT+20,-1,-1,
  29.    CLOSEWINDOW|NEWSIZE,
  30.    WINDOWSIZING|WINDOWDRAG|WINDOWDEPTH|WINDOWCLOSE|SMART_REFRESH|ACTIVATE,
  31.    NULL,NULL,"Fenster 3-Image-Demo",
  32.    NULL,NULL,WIDTH+40,HEIGHT+20,-1,-1,WBENCHSCREEN
  33. };
  34.  
  35. extern UWORD far ImageData[];   /* label '_ImageData' */
  36.  
  37. struct Image Bild =
  38. {
  39.    0,0,WIDTH,HEIGHT,2,
  40.    NULL,3,0,NULL  /* pointer will be installed later */
  41. };
  42.  
  43. struct IntuiMessage *Msg;
  44.  
  45. ULONG Class;
  46.  
  47.  
  48. /* -------------------- main -------------------------- */
  49.  
  50. void main (void)
  51. {
  52.  Bild.ImageData=ImageData; /* set pointer */
  53.  
  54.  /* open library */  
  55.  if (IntuitionBase=OpenLibrary("intuition.library",33))
  56.    {
  57.       
  58.     /* open window */   
  59.     if (WD=OpenWindow(&NW))
  60.        {
  61.         /* draw image */
  62.         DrawImage(WD->RPort,&Bild,WD->BorderLeft+6,WD->BorderTop+2);                 
  63.         do
  64.           {
  65.            /* wait for message */
  66.            (void)WaitPort(WD->UserPort);
  67.            if (Msg=(struct IntuiMessage *)GetMsg(WD->UserPort))
  68.               {
  69.                /* re-draw ? */
  70.                if ((Class=Msg->Class)==NEWSIZE)
  71.                   DrawImage(WD->RPort,&Bild,WD->BorderLeft+6,WD->BorderTop+2);                 
  72.                ReplyMsg((struct Message *)Msg);
  73.               }
  74.               else Class=0;
  75.         
  76.           }
  77.         while (Class!=CLOSEWINDOW); /* until user selects CLOSE gadget */
  78.         CloseWindow(WD);
  79.                 
  80.        }
  81.        else puts("cant open window !");
  82.  
  83.     CloseLibrary(IntuitionBase);
  84.    }
  85.     
  86.    else puts("cant open 'intuition.library' V33 !");
  87. }
  88.